package com.itheima.controller;

import com.itheima.Service.DeptService;
import com.itheima.pojo.Dept;
import com.itheima.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;
//这是一个请求处理类（@ResponseBody会将类或集合 转化为json格式响应）
@RestController
public class DeptController {
    //依赖注入
    @Autowired
    private DeptService deptService;

    @GetMapping("/depts")
    public Result list() throws IOException {
        List<Dept> list = deptService.list();
        System.out.println("瞎写一点");
        //返回响应数据
        return Result.success(list);
    }
}
